﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace GL_TakeEgg
{
    public class Basket
    {
        #region Private Variables
        private Image _img;
        private int _x;
        private int _y;
        private int _height;
        private int _width;
        private int _speed;
        #endregion

        public delegate void catchEgg_Handler(object sender);
        public event catchEgg_Handler catchEgg;

        // By Default, create an OnXXXX Method, to call the Event
        protected void TouchBottom()
        {
            if (catchEgg != null)
            {
                catchEgg(this);
            }
        }

        #region Properties

        public int X
        {
            set
            {
                _x = value;
            }
            get
            {
                return _x;
            }
        }

        public int Y
        {
            set
            {
                _y = value;
            }
            get
            {
                return _y;
            }
        }

        public int Height
        {
            set
            {
                _height = value;
            }
            get
            {
                return _height;
            }
        }

        public int Width
        {
            set
            {
                _width = value;
            }
            get
            {
                return _width;
            }
        }

        public int Speed
        {
            set
            {
                _speed = value;
            }
            get
            {
                return _speed;
            }
        }

        #endregion

        public Basket()
        {
            _img = GL_TakeEgg.Properties.Resources.Ro;
        }

        public void DrawFaller(Graphics g)
        {
            g.DrawImage(_img,_x,_y,Width,Height);
        }

        public void DrawFaller(Graphics g, int move_x, int move_y)
        {
            _x = move_x;
            _y = move_y;
            DrawFaller(g);
        }

        public void Moving(int screenWidth, int x)
        {
            X = X + x;
            if (X <= 180)
            {
                X = 180;
            }
            if (X >= 420 - Width)
            {
                X = 420 - Width;
            }
        }

    }
}
